#ifndef _events
#define _events

#include <arpa/inet.h>
#define MAX_EVENT_SIZE 512

enum EventType
{
	network=0,msg,file_ask,file_answer
};

enum Gender
{
	female=0,male
};

enum AnswerType
{
	allow=0,reject
};

enum Status
{
	online=0,offline,stealth
};

class AbstractEvent
{
public:
    long msg_type;
	static const int MAX_LENGTH_IP=INET_ADDRSTRLEN;
	char src_ip[MAX_LENGTH_IP];
	char dest_ip[MAX_LENGTH_IP];
	static const int MAX_LENGTH_NAME=20;
	char name[MAX_LENGTH_NAME];
	int src_pid;
	int dest_pid;
	EventType type;

	AbstractEvent();
};

class MsgEvent:public AbstractEvent
{
public:
	static const int MAX_LENGTH_MSG=100;
	char content[MAX_LENGTH_MSG];
	int	id;
	int parent_id;
    MsgEvent();
};

class NetworkEvent:public AbstractEvent
{
public:
	Gender gender;
	Status status;
    NetworkEvent();
};

class FileAskEvent:public AbstractEvent
{
public:
	static const int MAX_LENGTH_FILE_NAME=80;
	char file_name[MAX_LENGTH_FILE_NAME];
    FileAskEvent();
};

class FileAnswerEvent:public FileAskEvent
{
public:
    char store_name[MAX_LENGTH_FILE_NAME];
	AnswerType answer_type;
    FileAnswerEvent();
};

int size_event(AbstractEvent &event);

#endif
